#!/usr/bin/env python
from abc import abstractmethod

class MyClass:
    def __init__(self, key):
        self.key = key
        self.value = 0

    def set_val(self,val):
        self.value = val

    def update_val(self,val, obj):
        obj.set_val(val)

    def __str__(self):
        return "%s : %s" % (self.key, self.value)


a = MyClass('a')
a.set_val(17)
b = MyClass('b')
b.set_val(19)
c = {}
c[a.key] = a
c[b.key] = b

print (c)

c[b.key].update_val(16,a)

print (a)
print (b)

for key,val in c.iteritems() :
    print str(val)


